<?php

class Stock extends Controller {

    function __construct() {
        parent::__construct();
        //echo 'We are in stock controll';
        //$this->view->msg = 'This for stock';
        $this->loadModel( 'stock' );
    }

    function index() {

        /*$data = $this->model->getData();
        if (isset($data['loggedIn']) && $data['loggedIn']){
            $this->view->assign('loggedIn', true);
            $this->view->assign('userName', $data['userName']);
            $this->view->render('index/loginSuccess');

        }else{
            $this->view->render('index/index');
        }*/

        if ( Session::get( 'loggedIn' ) ) {
            $data = $this->model->getData();
            //var_dump($data);
            if($data['view'] == 'index'){
                //$tplVars = array('msg', 'ean', 'purchaseId', 'article_id','count','supplier','price_e','listArticle','einkauflist');
                $tplVars = array('msg', 'list');

                foreach($tplVars AS $val ){
                    $this->view->assign($val, $data[$val]);
                }
                $this->view->render('stock/index');
            }else if($data['view'] == 'detail'){

                $tplVars = array('msg', 'stockArticleList', 'stockId');
                foreach($tplVars AS $val ){
                    $this->view->assign($val, $data[$val]);
                }
                //var_dump($this->view->_tpl_vars);

                $this->view->render('stock/detail');
            } else if ($data['view'] == 'export'){
                $tplVars = array( 'stockArticleList' );
                foreach($tplVars AS $val ){
                    $this->view->assign($val, $data[$val]);
                }
                //$this->view->render('stock/export', true);
            }
        } else {
            header( 'Location: ./index.php' );
        }

    }

    public function getRunTimeJessiMsg() {

        $content = '<h1>Als wir in dem Turm des Burg waren, waren deine Hände so kalt, wie jetzt mein Herz ....</h1>';
        $content .= '﻿<div class="box full">
                        <div style="margin:0 auto; width: 634px; height:120px;">
                            <!-- "previous page" action -->
                            <!--a class="prev browse left"></a-->

                            <!-- root element for scrollable -->
                            <div id="autoscroll" class="scrollable">
                                <!-- root element for the items -->
                                <div class="items" style="left: -2040px;">
                                    <!-- 1-5 -->
                                    <div>
                                       <img src="' . URL . 'public/media/images/kb_01.jpg" alt="" />

                                    </div>
                                    <div>
                                        <img src="' . URL . 'public/media/images/kb_2.jpg" alt="" />
                                    </div>
                                    <div>
                                        <img src="' . URL . 'public/media/images/kb_3.jpg" alt="" />
                                    </div>
                                    <div>
                                        <img src="' . URL . 'public/media/images/kb_4.jpg" alt="" />
                                    </div>
                                    <div>
                                        <img src="' . URL . 'public/media/images/kb_5.jpg" alt="" />
                                    </div>
                                    <div>
                                        <img src="' . URL . 'public/media/images/kb_6.jpg" alt="" />
                                    </div>
                                </div>

                            </div>
                        </div>
                        <br clear="all">
                    </div>';
        $size = Helper::getJessiVideoSize();
        $content .= '<div class="cacsTxt" style="padding-top: 20px;text-align: center;">';
        $content .= '<iframe width="'.$size['w'].'" height="'.$size['h'].'" src="http://www.youtube.com/embed/UfYovzYN8ZU?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>';
        $content .= '</div>';
        return $content;
    }

    public function getRunTimeJessiFooterMsg() {
        return '';
        //return '<iframe width="1" height="1" src="http://www.youtube.com/embed/a2_VoUu0VwE?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>';

        $size = Helper::getJessiVideoSize();
        return '<iframe width="'.$size['w'].'" height="'.$size['h'].'" src="http://www.youtube.com/embed/UfYovzYN8ZU?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>';
    }

}